package v1

import (
	"gitee.com/liangziyisheng/caas-platform-mc/internal/consts"
	"gitee.com/liangziyisheng/caas-platform-mc/internal/model/do"
	"gitee.com/liangziyisheng/caas-platform-mc/internal/model/entity"

	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/os/gtime"
)

type StatusReq struct {
	g.Meta `path:"/employees/status" tags:"人员管理" method:"get" summary:"员工状态列表"`
}
type StatusRes struct {
	g.Meta `mime:"application/json"`
	Data   []consts.DdicStatus1 `json:"data"`
}

type ListReq struct {
	g.Meta       `path:"/employees" tags:"人员管理" method:"get" summary:"人员列表"`
	EmployeeNo   string `json:"employeeNo"   description:"员工编号"`
	NationalId   string `json:"nationalId"   description:"国民身份证号码"`
	Email        string `json:"email"       description:"电子邮箱"`
	Phone        string `json:"phone"      description:"联系电话"`
	DepartmentId int64  `json:"departmentId" description:"部门ID"`
	ManagerId    int64  `json:"managerId"   description:"直接上级员工ID"`
	Page         int    `json:"page"   v:"required|min:1"     description:"页码"`
	Size         int    `json:"size" v:"required|between:1,100"       description:"每页条数"`
}
type ListRes struct {
	g.Meta `mime:"application/json"`
	Data   []Emp `json:"data"`
	Total  int   `json:"total"`
}

type AddReq struct {
	g.Meta       `path:"/employees" tags:"人员管理" method:"post" summary:"添加人员"`
	EmployeeNo   string      `json:"employeeNo" v:"required"    description:"员工编号"`
	FirstName    string      `json:"firstName" v:"required"   description:"员工名字"`
	LastName     string      `json:"lastName"   v:"required"     description:"员工姓氏"`
	Gender       int         `json:"gender"     v:"required"     description:"性别"`
	Birthday     *gtime.Time `json:"birthday"      description:"出生日期"`
	NationalId   string      `json:"nationalId" v:"required"   description:"国民身份证号码"`
	Email        string      `json:"email"          description:"电子邮箱"`
	Phone        string      `json:"phone"          description:"联系电话"`
	HireDate     *gtime.Time `json:"hireDate"       description:"入职日期"`
	PositionId   int64       `json:"positionId"     description:"职位ID"`
	DepartmentId int64       `json:"departmentId" description:"部门ID"`
	ManagerId    int64       `json:"managerId"      description:"直接上级员工ID"`
	CountryCode  string      `json:"countryCode"   description:"国家"`
	ProvinceCode string      `json:"provinceCode"  description:"州/省"`
	CityCode     string      `json:"cityCode"         description:"城市"`
	CountyCode   string      `json:"countyCode"         description:"区/县"`
	Address      string      `json:"address"        description:"通讯地址"`
	PostalCode   string      `json:"postalCode"    description:"邮编"`
}
type AddRes struct {
	g.Meta `mime:"application/json"`
	Id     int64 `json:"id"`
}

type UpdateReq struct {
	g.Meta       `path:"/employees/{id}" tags:"人员管理" method:"put" summary:"更新人员"`
	Id           int64       `query:"id" v:"required|min:1" description:"人员ID"`
	FirstName    string      `json:"firstName"    description:"员工名字"`
	LastName     string      `json:"lastName"        description:"员工姓氏"`
	Gender       int         `json:"gender"          description:"性别"`
	Birthday     *gtime.Time `json:"birthday"      description:"出生日期"`
	Status       int         `json:"status" description:"状态"`
	NationalId   string      `json:"nationalId"    description:"国民身份证号码"`
	Email        string      `json:"email"          description:"电子邮箱"`
	Phone        string      `json:"phone"          description:"联系电话"`
	HireDate     *gtime.Time `json:"hireDate"       description:"入职日期"`
	PositionId   int64       `json:"positionId"     description:"职位ID"`
	DepartmentId int64       `json:"departmentId" description:"部门ID"`
	ManagerId    int64       `json:"managerId"      description:"直接上级员工ID"`
	CountryCode  string      `json:"countryCode"   description:"国家"`
	ProvinceCode string      `json:"provinceCode"  description:"州/省"`
	CityCode     string      `json:"cityCode"         description:"城市"`
	CountyCode   string      `json:"countyCode"         description:"区/县"`
	Address      string      `json:"address"        description:"通讯地址"`
	PostalCode   string      `json:"postalCode"    description:"邮编"`
}
type UpdateRes struct {
	g.Meta `mime:"application/json"`
	Rows   int64 `json:"rows"`
}

type DeleteReq struct {
	g.Meta `path:"/employees/{id}" tags:"人员管理" method:"delete" summary:"删除人员"`
	Id     int64 `query:"id" v:"required|min:1"`
}
type DeleteRes struct {
	g.Meta `mime:"application/json"`
	Rows   int64 `json:"rows"`
}

type Emp struct {
	Id           int64       `json:"id" description:""`
	EmployeeNo   string      `json:"employeeNo" v:"required"    description:"员工编号"`
	FirstName    string      `json:"firstName"    description:"员工名字"`
	LastName     string      `json:"lastName"        description:"员工姓氏"`
	Gender       int         `json:"gender"          description:"性别"`
	Birthday     *gtime.Time `json:"birthday"      description:"出生日期"`
	NationalId   string      `json:"nationalId"    description:"国民身份证号码"`
	Email        string      `json:"email"          description:"电子邮箱"`
	Phone        string      `json:"phone"          description:"联系电话"`
	HireDate     *gtime.Time `json:"hireDate"       description:"入职日期"`
	PositionId   int64       `json:"positionId"     description:"职位ID"`
	DepartmentId int64       `json:"departmentId" description:"部门ID"`
	ManagerId    int64       `json:"managerId"      description:"直接上级员工ID"`
	CountryCode  string      `json:"countryCode"   description:"国家"`
	ProvinceCode string      `json:"provinceCode"  description:"州/省"`
	CityCode     string      `json:"cityCode"         description:"城市"`
	CountyCode   string      `json:"countyCode"         description:"区/县"`
	Address      string      `json:"address"        description:"通讯地址"`
	PostalCode   string      `json:"postalCode"    description:"邮编"`
	Status       int         `json:"status"         description:"员工状态"`
}

// input and output struct
type ListInput struct {
	TenantCode   string `json:"tenantCode"`
	EmployeeNo   string `json:"employeeNo"   description:"员工编号"`
	NationalId   string `json:"nationalId"   description:"国民身份证号码"`
	Email        string `json:"email"       description:"电子邮箱"`
	Phone        string `json:"phone"      description:"联系电话"`
	DepartmentId int64  `json:"departmentId" description:"部门ID"`
	ManagerId    int64  `json:"managerId"   description:"直接上级员工ID"`
	Page         int    `json:"page"   v:"required|min:1"     description:"页码"`
	Size         int    `json:"size" v:"required|between:1,100"       description:"每页条数"`
}
type ListOutput struct {
	Data  []entity.Employee `json:"data"`
	Total int               `json:"total"`
}
type AddInput struct {
	do.Employee
}
type AddOutput struct {
	Id int64 `json:"id"`
}
type UpdateInput struct {
	do.Employee
}
type UpdateOutput struct {
	Rows int64 `json:"rows"`
}
type DeleteInput struct {
	Id         int64  `json:"id" description:"人员ID"`
	TenantCode string `json:"tenantCode"`
}
type DeleteOutput struct {
	Rows int64 `json:"rows"`
}
